home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / comm / irc / FloodHunter.lha / FloodHunter.amirx < prev    next >
Text File  |  2000-11-21  |  5KB  |  133 lines

  1. /* $VER: FloodHunter 1.0 (21.11.00)
  2. \\ Arexxscript for AmIRC to get a PingFlooders nick on IRC
  3. // Works only if the flooder is in a channel you are in too.
  4. \\ © by MellowBrain aka. Alexander Wachau E-Mail: MellowBrain@gmx.de
  5. // PingFloodHunter uses DNS done by chip@amiga.rulez.org (executable must be in c:)
  6. \\ Catch me on IRC: irc.uk.quakenet.eu.org:6667 #AmigaQuake as MellowB ICQ: 48057229
  7. */
  8.  
  9. Options Results
  10. PARSE ARG searchip
  11.  
  12.  
  13.  
  14. /* -============================Change the following lines to what u want!============================- */
  15.  
  16. miamilogfile = 'Miami:MiamiSystem.log'              /* Change this to the path of your MiamiSystem logfile. */
  17. usenetinfo = '0'                                    /* Change this if u want to use NetInfo to scan back 1 = Yes 0 = No */
  18. usenetinfoifnohit = '0'                             /* Change this to scan back even if user is not found on IRC? 1 = Yes 0 = NO */
  19. netinfopath = "Workplace:Online/NetInfo-II/NetInfo" /* Change this to the path of NetInfo on your harddisk with executable at the end! */
  20. notifyuser = '0'                                    /* Change this if u want to tell the flooder that you found him 1 = Yes 0 = No */
  21. notifytext = "Please stop the flood!"               /* Change this to what you want to tell the user */
  22.  
  23. /* -======End of the User changeable part -- Dont change anything below or the script wont work!======- */
  24.  
  25.  
  26.  
  27. AmIRCUserIPIn = 'ram:t/AmIRCUserIPIn'
  28. linecount = '0'
  29. newlinecount = '0'
  30. startout = ''
  31. charnumb = "LENGTH"(searchip)
  32. bold = d2c(2)
  33.  
  34. IF ( charnumb < '3' ) then SIGNAL MIAMISCAN
  35. IF ( searchip = 'HELP' ) then SIGNAL HELP
  36. IF ( searchip = 'help' ) then SIGNAL HELP; ELSE SIGNAL SCAN
  37.  
  38. /* Start MiamiSystemLogFile */
  39. MIAMISCAN:
  40. call echo ("Trying to get last IP from MiamiSystemLogFile... Could take a while with large files!")
  41. IF open(file,miamilogfile,'R') then DO
  42.     DO UNTIL eof(file)
  43.         line = ReadLN(file)
  44.         linecount = linecount + '1'
  45.     END
  46. close(file)
  47. linecount = linecount - '1'
  48. IF open(file,miamilogfile,'R') then DO
  49.     DO UNTIL newlinecount = linecount
  50.         line = ReadLn(file)
  51.         newlinecount = newlinecount + '1'
  52.     END
  53. close(file)
  54. IF line ~= "" then DO
  55.     parse var line date' 'time' 'ping' 'flood' 'from' 'IP' 'detected
  56.     parse var line date' 'time' 'access' 'from' 'host' 'otherIP' 'to' 'port' 'bla' 'allow
  57.     END
  58. END
  59. IF ( line = '' ) then sayerror = "MiamiSystem-logfile not found or errors in log!" & SIGNAL MIAMIERROR; ELSE sayerror = "No Errors found!"
  60. IF ( IP ~= ' ' ) then searchip = IP; ELSE searchip = otherIP
  61. IF ( searchip = 'session' ) then sayerror = "MiamiSystem-logfile not found or errors in log!"
  62. IF ( searchip = 'session' ) then SIGNAL MIAMIERROR
  63. END
  64. startout = "Got IP"bold searchip bold"from MiamiLogFile - PingFlooder Detection started! Could take a while if u are in channels with many users!"
  65.  
  66.     SIGNAL SCAN
  67.  
  68. EXIT
  69.  
  70. /* Start Scaning */
  71. SCAN:
  72. options results; "CHANNELS"; allchannels = result
  73. channumb = "WORDS"(allchannels)
  74. chanstart = '1'
  75. userstart = '0'
  76. output = "PingFlooder not on any joined channel!"
  77. IF ( startout = '' ) then startout = "PingFlooder Detection of IP"bold searchip bold"started! Could take a while if u are in channels with many users!"
  78. call echo(startout)
  79.  
  80. DO UNTIL chanstart = channumb
  81.  
  82.   DO UNTIL userstart = usernumb
  83.    options results; "GETUSERS WINNUM="chanstart; allchanusers = result
  84.    usernumb = "WORDS"(allchanusers)
  85.    options results; "GETUSER" userstart "WINNUM="chanstart; user = result
  86.    options results; "USERHOST" user; host = result
  87.    parse var host username '@' isp
  88.    ADDRESS COMMAND 'c:dns ' isp ' > 'AmIRCUserIPIn
  89.    open(file,AmIRCUserIPIn,'R')
  90.     IPResult = readln(file)
  91.     close(file)
  92.     delete(AmIRCUserIPIn)
  93.    userstart = userstart + '1'
  94.    IF ( userstart > usernumb ) then chanstart = chanstart + '1'
  95.    IF ( userstart > usernumb ) then userstart = '0'
  96.    IF ( IPResult = searchip ) then output = "IP from"bold User bold"in channel "channameout" and"bold searchip bold"are the same! >>Ping Flooder Found!<<"
  97.    options results; "GETCHANNEL WINNUM="chanstart; channame = result
  98.    IF ( output ~= "PingFlooder not on any joined channel!" ) then channameout = channame
  99.    IF ( IPResult = searchip ) then output = "IP from"bold User bold"in channel "channameout" and"bold searchip bold"are the same! >>Ping Flooder Found!<<"
  100.    IF ( IPResult = searchip ) then notifyusername = user
  101.    IF ( IPResult = searchip ) then SIGNAL OUTPUT
  102.   END
  103.  
  104. END
  105.  
  106.    SIGNAL OUTPUT
  107.  
  108. EXIT
  109.  
  110. /* Help */
  111. HELP:
  112. call echo ("Just enter the IP to search for behind the script or alias name. If u dont enter an IP it will scan your MiamiSystemLogfile for the last IP that scanned or accessed you.")
  113. END
  114. EXIT
  115.  
  116. /* MiamiError */
  117. MIAMIERROR:
  118. call echo (sayerror)
  119. EXIT
  120.  
  121. /* OutPut */
  122. OUTPUT:
  123. IF ( usenetinfo = '1' ) & ( usenetinfoifnohit = '1' ) then ADDRESS COMMAND 'c:runback ' netinfopath ' ' searchip
  124. IF ( notifyuser = '1' ) & ( notifyusername ~= "NOTIFYUSERNAME" ) then 'say /msg ' notifyusername ' ' notifytext
  125. call echo(output)
  126. EXIT
  127.  
  128. echo: procedure
  129.         parse arg a
  130.         "ECHO P="d2c(27)"b«"PFH"» C=6" a
  131. return 1
  132.  
  133.